package argo.hot100;

import java.util.Arrays;

public class MoveZeroes {

    private void swap(int[] arr, int i, int j) {
        int temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }


    public void moveZeroes(int[] nums) {
        int l0 = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != 0) {
                swap(nums, i, l0);
                l0++;
            }
        }
    }

    public static void main(String[] args) {
        int[] ints = {1,0, 1, 0, 3, 12};
        new MoveZeroes().moveZeroes(ints);
        System.out.println(Arrays.toString(ints));
    }

}
